package com.sgb.kjwl.view.ui.fragment.home;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.util.Pair;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.viewpager2.widget.ViewPager2;

import com.alibaba.android.arouter.launcher.ARouter;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.sgb.auction.activity.AuctionHallActivity;
import com.sgb.jicai.view.activity.FactoryCentralizedActivity;
import com.sgb.jicai.view.activity.JcMyPriceActivity;
import com.sgb.jicai.view.activity.JiCaiDaTingActivity;
import com.sgb.jicai.view.activity.MyCenterMyJoinActivity;
import com.sgb.jicai.view.activity.XuFangFaQiActivity;
import com.sgb.jicai.view.fragment.FactoryCentralizedFragment;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.FragmentHomeMaterialBinding;
import com.sgb.kjwl.di.home.DaggerHomeFragComponent;
import com.sgb.kjwl.di.home.HomeFragModule;
import com.sgb.kjwl.model.entity.HomeMenuEntity;
import com.sgb.kjwl.model.entity.IndustryHomeListEntity;
import com.sgb.kjwl.model.entity.LoginEntity;
import com.sgb.kjwl.model.entity.UserMsgEntity;
import com.sgb.kjwl.model.entity.businessmanagement.GoodsIndexMemberEntity;
import com.sgb.kjwl.model.entity.home.UpdateIndexEvent;
import com.sgb.kjwl.view.ui.activity.pick.PickListActivity;
import com.sgb.kjwl.view.ui.activity.transport.BiddingTransportHallActivity;
import com.sgb.kjwl.view.ui.activity.transport.DriverLookForGoodsActivity;
import com.sgb.link.router.PathTeam;
import com.swgk.core.base.AppFragment;
import com.swgk.core.view.entity.EnterpriseEditEntity;
import com.sgb.kjwl.model.entity.user.GoodsIndexEntity;
import com.swgk.core.util.ACAdminDialogUtils;
import com.sgb.kjwl.utils.ActivityJump;
import com.sgb.kjwl.utils.NumberConstant;
import com.swgk.core.util.UserOperating;
import com.sgb.kjwl.view.event.CategoryEvent;
import com.sgb.kjwl.view.event.CategoryEvent2;
import com.sgb.kjwl.view.event.ChooseAreaEvent;
import com.swgk.core.event.EventConstant;
import com.sgb.kjwl.view.event.LoginEvent;
import com.sgb.kjwl.view.ui.activity.enterprise.MakeOverActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.NeedActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.ProfessionalQuoteActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.ProfessionalTeamChangeActivity;
import com.sgb.kjwl.view.ui.activity.lease.LeaseHallActivity2;
import com.sgb.kjwl.view.ui.activity.manage.CompanyTradesActivity;
import com.sgb.kjwl.view.ui.activity.manage.EpAssestActivity;
import com.sgb.kjwl.view.ui.activity.manage.IPActivity;
import com.sgb.kjwl.view.ui.activity.manage.ManageActivity;
import com.sgb.kjwl.view.ui.activity.manage.SpecialQualificationActivity;
import com.sgb.kjwl.view.ui.activity.manage.TradeHonorActivity;
import com.sgb.kjwl.view.ui.activity.packers.FindPackersActivity;
import com.sgb.kjwl.view.ui.activity.packers.PackersEmploymentActivity;
import com.sgb.kjwl.view.ui.activity.packers.PackersEngineeringCompanyActivity;
import com.sgb.kjwl.view.ui.activity.packers.PackersFindPeopleActivity;
import com.sgb.kjwl.view.ui.activity.packers.ServicesCompanyActivity;
import com.sgb.kjwl.view.ui.activity.pick.PickBiddingListActivity;
import com.sgb.kjwl.view.ui.activity.pick.PickHallActivity3;
import com.sgb.kjwl.view.ui.activity.pick.PickNoticeActivity;
import com.sgb.kjwl.view.ui.activity.pick.PickWinningNoticeActivity;
import com.sgb.kjwl.view.ui.activity.quotedprice.QuotedPriceActivity;
import com.sgb.kjwl.view.ui.activity.transport.GoodsCarsActivity;
import com.swgk.core.view.adapter.MenuAdapter;
import com.sgb.kjwl.view.ui.quickentry.QuickEntryClickListener;
import com.sgb.kjwl.view.ui.quickentry.QuickEntryEntity;
import com.sgb.kjwl.view.ui.quickentry.QuickEntryPopWindow;
import com.swgk.core.view.weiget.BigHomeComparyWidget;
import com.sgb.link.event.MaterialEvent;
import com.swgk.core.event.MenuEvent;
import com.sgb.kjwl.view.ui.activity.MainActivity;
import com.sgb.kjwl.view.ui.activity.ShoppingCar.ShoppingCartActivity;
import com.sgb.kjwl.view.ui.activity.home.HomeCategoryActivity;
import com.sgb.kjwl.view.ui.activity.home.SearchActivity3;
import com.sgb.kjwl.view.ui.activity.manage.EnterpriseAndMapActivity;
import com.sgb.kjwl.view.ui.activity.manage.WebsiteInfoActivity;
import com.sgb.kjwl.view.ui.activity.manage.special.InviteMemberListActivity;
import com.sgb.kjwl.view.ui.activity.material.GoodsAggregateActivity;
import com.sgb.kjwl.view.ui.activity.material.hall.NewDemandHallActivity;
import com.sgb.kjwl.view.ui.activity.power.PowerListActivity;
import com.sgb.kjwl.view.ui.activity.self.JoinCompanyActivity;
import com.sgb.kjwl.view.ui.activity.self.authentication.AuthActivity3;
import com.sgb.kjwl.view.ui.activity.self.userInfo.RegisterActivity3;
import com.sgb.kjwl.view.ui.activity.self.userInfo.VerificationCodeLoginActivity;
import com.sgb.kjwl.view.ui.activity.supplier3.SupplierActivity4;
import com.sgb.kjwl.view.ui.adapter.home.GoodsCompanyAdapter;
import com.sgb.kjwl.view.ui.adapter.home.GoodsNavigationAdapter;
import com.sgb.kjwl.view.ui.adapter.home.MateriaIndustryAdapter;
import com.sgb.kjwl.view.ui.adapter.home.TabFragmentStateAdapter;
import com.sgb.kjwl.view.ui.fragment.HomeFragment3;
import com.sgb.kjwl.view.ui.fragment.material.MerchantRecommendationFragment;
import com.sgb.kjwl.view.ui.fragment.material.NewDemandHallFragment;
import com.swgk.core.view.weiget.CountMenuView;
import com.sgb.kjwl.view.widget.HomeGoodsSelectionTypePopWindow;
import com.sgb.kjwl.view.widget.ThreeButtonDialog;
import com.sgb.kjwl.viewmodel.home.MaterialHomeModel1;
import com.sgb.link.router.PathMerchant;
import com.sgb.member.ui.activity.MemberAuditActivity;
import com.sgb.member.ui.activity.MemberInviteOrApplyActivity;
import com.sgb.member.ui.activity.MemberManageActivity;
import com.sgb.zhaocai.view.demand.activity.DemandForecastActivity;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.dialog.RoundCornerDialog;
import com.swgk.core.dialog.RoundDialog;
import com.swgk.core.mmkvutil.CacheMarker;
import com.swgk.core.mmkvutil.DatalUtils;
import com.swgk.core.mmkvutil.MkvUtils;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;
import com.swgk.core.recyclerview.adapter.PageRecycleAdapter;
import com.swgk.core.refresh.SuperSwipeRefreshLayout;
import com.swgk.core.util.MLog;
import com.swgk.core.util.MToast;
import com.swgk.core.util.ScaleUtils;
import com.swgk.core.util.SharedPreferenceUtil;
import com.swgk.core.view.entity.MenuEntity;
import com.swgk.core.xrecyclerview.AppBarStateChangeListener;
import com.zhy.view.flowlayout.TagAdapter;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

import static com.swgk.core.util.ACAdminDialogUtils.MK_OURINQUIRYPRICELIST;
import static com.sgb.kjwl.utils.NumberConstant.TEAM_CONSTRUCTION;
import static com.swgk.core.event.EventConstant.EVENT_GOODS_HOME_JUMP;
import static com.swgk.core.event.EventConstant.EVENT_MAP_HOME_JUMP;

/**
 * @author Administrator1
 * 首页的商品界面
 */
public class MaterialHomeFragment1 extends AppFragment implements QuickEntryClickListener {

    private FragmentHomeMaterialBinding mBinding;
    @Inject
    MaterialHomeModel1 model;
    public static final String KEY_TYPE = "type";
    private boolean isCreate = false;
    private boolean init = true;
    private boolean isVisible;
    private GoodsNavigationAdapter goodsNavigationAdapter;
    private GoodsCompanyAdapter goodsCompanyAdapter;
    private MateriaIndustryAdapter materiaIndustryAdapter;
    private HomeGoodsSelectionTypePopWindow homeGoodsSelectionTypePopWindow;
    private List<MenuEntity> bundleData = new ArrayList<>();
    private List<MenuEntity> data;
    private List<MenuEntity> dataList = new ArrayList<>();
    private List<MenuEntity> menuEntityList = new ArrayList<>();
    private List<MenuEntity<MenuEntity<MenuEntity>>> menuEntityList1 = new ArrayList<>();
    private List<MenuEntity> industryList;
    private HomeFragment3 homeFragment3;
    private TextView textView;
    private boolean isExpand;
    private boolean isLoad;

    String mIndustryId = "";
    String mIndustry = "";

    private List<GoodsIndexEntity> listGoodsInfo = new ArrayList<>();

    private final String[] tagName = {"商品", "自营", "集采", "促销", "需求大厅", "供应商"};
    private TabFragmentStateAdapter mTabFragmentStateAdapter;
    List<Fragment> fragmentList = new ArrayList<>();
    private static final String Success = "SUCCESS";

    private int indexClickPosition = 0;
    private int count = 6;
    private GridLayoutManager manager;
    private List<MenuEntity> menuDataList = new ArrayList<>();

    private QuickEntryPopWindow quickEntryPopWindow; //快捷入口弹框
    private List<MenuEntity> titleData;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_home_material, container, false);
        return mBinding.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    }

    public static MaterialHomeFragment1 newInstance(String type) {
        MaterialHomeFragment1 fragment = new MaterialHomeFragment1();
        Bundle bundle = new Bundle();
        bundle.putString(KEY_TYPE, type);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    protected void setupFragmentComponent(AppComponent appComponent) {
        DaggerHomeFragComponent.builder()
                .appComponent(appComponent)
                .homeFragModule(new HomeFragModule(this))
                .build()
                .inject(this);
    }


    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        isVisible = isVisibleToUser;
        if (!isCreate) {
            return;
        }
        if (isVisibleToUser) {
            if (init) {
                init = false;
                initView();
                init();
            }
        }
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this);
        }
        isCreate = true;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initView();
        if (init && isVisible) {
            init = false;
            init();
        }
    }


    private void initView() {
        setCompanyData();
        mBinding.noDataBtn.setOnClickListener(this);
        mBinding.noLogin.setOnClickListener(this);
        mBinding.imgShopCar.setOnClickListener(this);
        mBinding.imgBackTop.setOnClickListener(this);
        mBinding.llBtn.setOnClickListener(this);
        mBinding.ivAskPrice.setOnClickListener(this);
        mBinding.ivQuickEntry.setOnClickListener(this);
        mBinding.containerDown.setOnClickListener(this);
        mBinding.swipeRefresh.setOnPullRefreshListener(new SuperSwipeRefreshLayout.OnPullRefreshListener() {
            @Override
            public void onRefresh() {
                textView.setText("正在刷新");
                model.getIndustryListdata("", mIndustryId);
                model.recommendMenu();
                refreshFragment();
                for (int i = 0; i < listGoodsInfo.size(); i++) {
                    listGoodsInfo.get(i).setSelect(false);
                }
                listGoodsInfo.get(0).setSelect(true);
                indexClickPosition = 0;
                initMember();
                bigHomeCompary.unInit();
                //获取首页企业推荐
                model.getCompanyTitleList("EventConstant.EVENT_NOTICE_REFRESH_HOME");
            }

            @Override
            public void onPullDistance(int distance) {

            }

            @Override
            public void onPullEnable(boolean enable) {
                textView.setText(enable ? "释放立即刷新" : "下拉刷新");
            }
        });

        mBinding.swipeRefresh.setHeaderView(createHeaderView());

        if (materiaIndustryAdapter == null) {
            materiaIndustryAdapter = new MateriaIndustryAdapter(getActivity(), null);
        }
        LinearLayoutManager rvClassifyBtnM = new LinearLayoutManager(getActivity());
        mBinding.rvClassify.setLayoutManager(rvClassifyBtnM);
        mBinding.rvClassify.setAdapter(materiaIndustryAdapter);
        materiaIndustryAdapter.setItemSelect(true);
        materiaIndustryAdapter.setOnItemClick(new AdapterOnItemClick<MenuEntity>() {
            @Override
            public void onItemClick(MenuEntity menuEntity, int position) {
                mIndustryId = menuEntity.getId();
                mIndustry = menuEntity.getName();
                model.getIndustryListdata("", mIndustryId);
                isExpand = true;
                expend();
            }
        });

        goodsNavigationAdapter = new GoodsNavigationAdapter(getContext(), null);
//        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false);
//        mBinding.recyclerViewImg.setLayoutManager(linearLayoutManager);
        manager = new GridLayoutManager(getContext(), 6);
        manager.setOrientation(count == 1 ? LinearLayoutManager.VERTICAL : LinearLayoutManager.HORIZONTAL);
        mBinding.recyclerViewImg.setLayoutManager(manager);
        mBinding.recyclerViewImg.setAdapter(goodsNavigationAdapter);
        manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
            @Override
            public int getSpanSize(int position) {
                return count;
            }
        });

        goodsNavigationAdapter.setOnItemClick(new AdapterOnItemClick<MenuEntity>() {
            @Override
            public void onItemClick(MenuEntity menuEntity, int position) {
                if ("2".equals(menuEntity.getId())) {
                    homeFragment3.goLogin(getActivity());
                } else if ("26".equals(menuEntity.getId())) {
                    SupplierActivity4.start(getActivity(), true, bundleData);
                } else if ("23".equals(menuEntity.getId())) {
                    NewDemandHallActivity.start(getActivity());
                } else if ("35".equals(menuEntity.getId()) && !UserOperating.getInstance().isLogged()) {
                    jumpLogin();
                } else if ("36".equals(menuDataList.get(position).getId())) {
                    AuctionHallActivity.start(getActivity(), "2");
                } else {
                    List<MenuEntity> menuEntities = getMenuEntities(goodsNavigationAdapter.getDatas());
                    boolean isNeed = false;
                    for (MenuEntity menuEntity1 : menuEntities) {
                        if ("36".equals(menuEntity1.getId())) {
                            isNeed = true;
                            break;
                        }
                    }
                    if (isNeed) {
                        menuEntities.remove(5); //拍卖大厅
                    }
                    menuEntities.remove(5); //需求大厅
                    menuEntities.remove(5); //查找地图
                    if (position >= 7) {
                        if (isNeed) {
                            position = position - 3;
                        } else {
                            position = position - 2;
                        }
                    }
                    DatalUtils.getInstance().putData(MkvUtils.CacheModular, CacheMarker.CacheGoodsCategoryModel, menuEntityList1);
                    GoodsAggregateActivity.start(getActivity(), menuEntities, position, "", null, null, false);
                }
            }
        });

        GoodsIndexEntity entity1 = new GoodsIndexEntity("成员", true, R.mipmap.goods_icon_chengyuan_1, R.mipmap.goods_icon_chengyuan_2);
        GoodsIndexEntity entity2 = new GoodsIndexEntity("会员", false, R.mipmap.goods_icon_huiyuan_1, R.mipmap.goods_icon_huiyuan_2);
        GoodsIndexEntity entity3 = new GoodsIndexEntity("关注", false, R.mipmap.goods_icon_guanzhu_1, R.mipmap.goods_icon_guanzhu_2);
        GoodsIndexEntity entity4 = new GoodsIndexEntity("推荐", false, R.mipmap.goods_icon_tuijian_1, R.mipmap.goods_icon_tuijian_2);
        GoodsIndexEntity entity5 = new GoodsIndexEntity("商机", false, R.mipmap.goods_icon_shangji_1, R.mipmap.goods_icon_shangji_2);
        GoodsIndexEntity entity6 = new GoodsIndexEntity("分类", false, R.mipmap.goods_icon_fenlei_1, R.mipmap.goods_icon_fenlei_2);
        listGoodsInfo.clear();
        listGoodsInfo.add(entity1);
        listGoodsInfo.add(entity2);
        listGoodsInfo.add(entity3);
        listGoodsInfo.add(entity4);
        listGoodsInfo.add(entity5);
        listGoodsInfo.add(entity6);
        mBinding.tlCompanyTitle.removeAllTabs();
        for (int i = 0; i < listGoodsInfo.size(); i++) {
            mBinding.tlCompanyTitle.addTab(mBinding.tlCompanyTitle.newTab().setText(listGoodsInfo.get(i).getTitle()));
        }
        for (int i = 0; i < listGoodsInfo.size(); i++) {
            View view = LayoutInflater.from(getActivity()).inflate(R.layout.item_goods_index, null, false);
            mBinding.tlCompanyTitle.getTabAt(i).setCustomView(view);
            TextView tv = mBinding.tlCompanyTitle.getTabAt(i).getCustomView().findViewById(R.id.tv_title);
            tv.setBackgroundResource(listGoodsInfo.get(i).getResourceUnCheckedId());
        }
        mBinding.tlCompanyTitle.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                int tabPosition = tab.getPosition();
                updateTabTextView(tab, true, tabPosition);
                if (tabPosition == 4 || tabPosition == 5) {
                    MToast.showToast(getActivity(), "功能开发中...");
                    return;
                } else {
                    if (indexClickPosition == tabPosition) {
                        return;
                    }
                    indexClickPosition = tabPosition;
                    if (tabPosition == 0) {//成员
                        initMember();
                    } else if (tabPosition == 1) {//会员
                        initLeague();
                    } else if (tabPosition == 2) {//关注
                        initCompanyFocus();
                    } else if (tabPosition == 3) {//推荐
                        initSupplier();
                    }
                }
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
                updateTabTextView(tab, false, tab.getPosition());
            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });
        updateTabTextView(mBinding.tlCompanyTitle.getTabAt(0), true, 0);
        goodsCompanyAdapter = new GoodsCompanyAdapter(null);
        mBinding.recyclerIndexData.setLayoutManager(new GridLayoutManager(getContext(), 3));
        mBinding.recyclerIndexData.setAdapter(goodsCompanyAdapter);
        goodsCompanyAdapter.setOnItemClickListener((adapter, view, position) -> {
            GoodsIndexMemberEntity item = (GoodsIndexMemberEntity) adapter.getItem(position);
            //0 成员 1 会员 2 关注 3 推荐
            if ("0".equals(item.getType()) || "1".equals(item.getType()) || "2".equals(item.getType())) {
                WebsiteInfoActivity.start(getActivity(), item.getCompanyNo(), 1);
            } else if ("3".equals(item.getType())) {
                WebsiteInfoActivity.start(getActivity(), item.getSupplier(), 1);
            }
        });

        homeGoodsSelectionTypePopWindow = new HomeGoodsSelectionTypePopWindow(getActivity());
        homeGoodsSelectionTypePopWindow.setDefItem(0);
        mBinding.appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
            @Override
            public void onStateChanged(AppBarLayout appBarLayout, State state) {
                if (state == State.EXPANDED) {
                    //展开状态
                    EventBus.getDefault().postSticky(new MaterialEvent().setMessageTag(EventConstant.EVENT_APPBAR_STATE_EXPANDED));
                    mBinding.swipeRefresh.setEnabled(true);
                } else if (state == State.COLLAPSED) {
                    //折叠状态
                    EventBus.getDefault().postSticky(new MaterialEvent().setMessageTag(EventConstant.EVENT_APPBAR_STATE_COLLAPSED));
                    mBinding.swipeRefresh.setEnabled(false);
                } else {
                    //中间状态
                    mBinding.swipeRefresh.setEnabled(false);
                    EventBus.getDefault().postSticky(new MaterialEvent().setMessageTag(EventConstant.EVENT_APPBAR_STATE_COMMON));
                }
            }
        });
        mBinding.appBarLayout.post(this::initAppbar);
        mBinding.llClassify.setVisibility(View.GONE);

    }

    private void updateTabTextView(TabLayout.Tab tab, boolean isSelect, int position) {
        if (tab == null || tab.getCustomView() == null) {
            return;
        }
        TextView tv = tab.getCustomView().findViewById(R.id.tv_title);
        if (isSelect) {
            tv.setBackgroundResource(listGoodsInfo.get(position).getResourceCheckedId());
        } else {
            tv.setBackgroundResource(listGoodsInfo.get(position).getResourceUnCheckedId());
        }
    }

    private void refreshFragment() {
        MaterialEvent materialEvent = new MaterialEvent();
        materialEvent.setMessageTag(EventConstant.EVENT_REFRESH_FRAGMENT);
        EventBus.getDefault().post(materialEvent);
    }

    /***
     * 复制MenuEntity数组
     * @param menuEntities
     * @return
     */
    private List<MenuEntity> getMenuEntities(List<MenuEntity> menuEntities) {
        List<MenuEntity> menuEntityList = new ArrayList<>();
        if (menuEntities != null || menuEntities.size() > 0) {
            for (MenuEntity menuEntity : menuEntities) {
                MenuEntity menuEntity1 = new MenuEntity();
                menuEntity1.setDatas(menuEntity.getDatas());
                menuEntity1.setUrl(menuEntity.getUrl());
                menuEntity1.setSelected(menuEntity.isSelected());
                menuEntity1.setParentId(menuEntity.getParentId());
                menuEntity1.setName(menuEntity.getName());
                menuEntity1.setImageResource(menuEntity.getImageResource());
                menuEntity1.setId(menuEntity.getId());
                menuEntity1.setIconContent(menuEntity.getIconContent());
                menuEntity1.setHostImg(menuEntity.getHostImg());
                menuEntity1.setAppIconUrl(menuEntity.getAppIconUrl());
                menuEntity1.setAppIcon(menuEntity.getAppIcon());
                menuEntityList.add(menuEntity1);
            }
        }
        return menuEntityList;
    }

    public void initAppbar() {
        CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) mBinding.appBarLayout.getLayoutParams();
        AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) params.getBehavior();
        if (behavior != null) {
            behavior.setDragCallback(new AppBarLayout.Behavior.DragCallback() {
                @Override
                public boolean canDrag(@NonNull AppBarLayout appBarLayout) {
                    return true;
                }
            });
        }
    }

    private View createHeaderView() {
        View headerView = LayoutInflater.from(mBinding.swipeRefresh.getContext())
                .inflate(R.layout.super_swipe_refresh_head, null);
        ProgressBar progressBar = headerView.findViewById(R.id.pb_view);
        textView = headerView.findViewById(R.id.text_view);
        textView.setText("下拉刷新");
        progressBar.setVisibility(View.GONE);
        return headerView;
    }

    private void init() {
        model.getIndustryListdata("", mIndustryId);
        model.getCategoryModel("");
        model.recommendMenu();
        homeFragment3 = (HomeFragment3) getParentFragment();

        if (titleData == null) {
            //商品列表需要的数据
            model.firstRecommendMenu();
        }
        model.getCompanyTitleList("init");
    }


    @SuppressLint("NonConstantResourceId")
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.img_more:
                EventBus.getDefault().postSticky(CategoryEvent.make(EventConstant.EVENT_CATEGORY_CHOOSE, 0));
                HomeCategoryActivity.start(getActivity());
                break;
            case R.id.ll_see_more:
                if (null == data || data.size() == 0) {
                    return;
                }
                homeGoodsSelectionTypePopWindow.setData(dataList);
                break;
            case R.id.et_view:
                SearchActivity3.start(getActivity(), 0);
                break;
            case R.id.img_back_top:
                scrollToTop();
                break;
            case R.id.img_shop_car:
                if (certification()) {
                    ShoppingCartActivity.start(getActivity());
                }
                break;
            case R.id.ll_btn:
                if (industryList == null) {
                    model.getIndustryList();
                } else {
                    expend();
                }
                break;
            case R.id.iv_ask_price:
                homeFragment3.goLogin(getContext());
                break;
            case R.id.no_login:
                if (!UserOperating.getInstance().isLogged()) {
                    jumpLogin();
                }
                break;
            case R.id.no_data_btn:
                if (indexClickPosition == 0) {
                    if (MemberApplyJoin()) {
                        InviteMemberListActivity.launch(getActivity());
                    }
                } else if (indexClickPosition == 1) {
                    if (LeageApplyJoin()) {
                        MemberInviteOrApplyActivity.startInviteOrApply(getActivity(), 0);
                    }
                } else if (indexClickPosition == 2) {
                    String longitude = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LONGITUDE_ID, "");
                    String latitude = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LATITUDE_ID, "");
                    EnterpriseAndMapActivity.start(getActivity(), longitude, latitude, false);
                }
                break;

            case R.id.container_down:
                RelativeLayout.LayoutParams recyclerViewImgParams = (RelativeLayout.LayoutParams) mBinding.recyclerViewImg.getLayoutParams();
                mBinding.imgDownUp.setImageDrawable(isDefaultStyle ? getResources().getDrawable(R.mipmap.goods_icon_menu_down) : getResources().getDrawable(R.mipmap.goods_icon_menu_up));
                if (isDefaultStyle) {
//                    count = 1;
                    isDefaultStyle = false;
//                    recyclerViewImgParams.setMargins(0,0,0, DensityUtils.dip2px(getActivity(), 3));
                    mBinding.recyclerViewImg.setVisibility(View.VISIBLE);
                    mBinding.flow.setVisibility(View.GONE);
                } else {
                    isDefaultStyle = true;
//                    recyclerViewImgParams.setMargins(0,0,0, DensityUtils.dip2px(getActivity(), 9));
                    mBinding.recyclerViewImg.setVisibility(View.GONE);
                    mBinding.flow.setVisibility(View.VISIBLE);
                }
             /*   count = count == 1 ? 6 : 1;
                manager.setOrientation(count == 1 ? LinearLayoutManager.VERTICAL : LinearLayoutManager.HORIZONTAL);
                goodsNavigationAdapter.notifyDataSetChanged();*/
                break;

            case R.id.iv_quick_entry:
                if (quickEntryPopWindow == null) {
                    quickEntryPopWindow = new QuickEntryPopWindow(getActivity());
                    //必须调用
                    quickEntryPopWindow.setListener(this::onItemClick);
                }
                quickEntryPopWindow.backgroundAlpha(0.5f);
                quickEntryPopWindow.setRecover();
                quickEntryPopWindow.showPopwindowLeft(mBinding.ivQuickEntry);

                goodsNavigationAdapter.notifyDataSetChanged();
                break;
            default:
                break;
        }
    }

    boolean isDefaultStyle;

    private boolean certification() {
        if (!UserOperating.getInstance().isLogged()) {
            jumpLogin();
            return false;
        }
        int type = UserOperating.getInstance().getUserIdentity();
        if (type == 0) {
            if (Success.equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.ENTERPRISE_AUTH, ""))) {
                showDialog();
            } else {
                new ThreeButtonDialog.Builder(getContext())
                        .content("当前暂不支持个人用户下单，加入企\n业/认证企业后可下单")
                        .confirm("认证企业")
                        .cancel("知道了")
                        .confirmCallback(v -> {
                            RegisterActivity3.start(getContext(), true);
                        }).joinCallback(v -> {
                    JoinCompanyActivity.start(getActivity());
                }).show();
            }
            return false;

        } else if (type == 1) {
            int type1 = ACAdminDialogUtils.isPermissionForAsk(MK_OURINQUIRYPRICELIST, false);
            if (type1 != ACAdminDialogUtils.TYPE_NORMAL /*&& !Success.equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.ENTERPRISE_AUTH, ""))*/) {
                MToast.showToast(getContext(), "您没有权限，请联系管理员开通");
                return false;
            }
        }
        return true;
    }

    /***
     * 提示弹窗
     * @param
     * @param
     */
    private void showDialog() {
        View view = View.inflate(getContext(), R.layout.dialog_one_btn, null);
        final RoundCornerDialog roundCornerDialog = new RoundCornerDialog(getContext(), 0, 0, view, R.style.RoundCornerDialog);
        roundCornerDialog.show();
        roundCornerDialog.setCanceledOnTouchOutside(false);
        TextView tv_title = view.findViewById(R.id.tv_title);
        TextView tv_message = view.findViewById(R.id.tv_message);
        tv_title.setVisibility(View.GONE);
        tv_message.setText("当前暂不支持个人用户下单，请切换\n到企业身份后再试");
        TextView tv_logout_confirm = view.findViewById(R.id.tv_logout_confirm);
        tv_logout_confirm.setText("知道了");
        tv_logout_confirm.setTextColor(requireContext().getResources().getColor(R.color.color_5792FD));
        tv_message.setTextColor(requireContext().getResources().getColor(R.color.color_666666));
        tv_message.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
        tv_logout_confirm.setOnClickListener(v -> roundCornerDialog.dismiss());
    }

    private void expend() {
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mBinding.llClassify.getLayoutParams();
        if (!isExpand) {
            lp.leftMargin = 0;
            mBinding.ivClassify.setRotation(0);
        } else {
            lp.leftMargin = ScaleUtils.px2dip(requireActivity(), -65);
            mBinding.ivClassify.setRotation(180);
        }
        mBinding.llClassify.setLayoutParams(lp);
        isExpand = !isExpand;
    }

    public void scrollToTop() {
        //拿到 appbar 的 behavior,让 appbar 滚动
        ViewGroup.LayoutParams layoutParams = mBinding.appBarLayout.getLayoutParams();
        AppBarLayout.Behavior behavior = (AppBarLayout.Behavior) ((CoordinatorLayout.LayoutParams) layoutParams).getBehavior();
        if (behavior != null) {
            //拿到下方tabs的y坐标，即为我要的偏移量
            float y = mBinding.calendarMenuView.getY();
            //注意传递负值
            behavior.setTopAndBottomOffset((int) -y);
        }
    }

    public List<MenuEntity> getData() {
        return goodsNavigationAdapter.getDatas();
    }

    public void showImageButton(List<MenuEntity> dataList) {
        mBinding.swipeRefresh.setRefreshing(false);
        goodsNavigationAdapter.setDatas(dataList);
        menuDataList = dataList;
        isDefaultStyle = true;
        onClick(mBinding.containerDown);

        TagAdapter searchAdapter = new TagAdapter<MenuEntity>(dataList) {
            @Override
            public View getView(com.zhy.view.flowlayout.FlowLayout parent, int position, MenuEntity menuEntity) {
                final LayoutInflater mInflater = LayoutInflater.from(mBinding.containerDown.getContext());
                LinearLayout layout = (LinearLayout) mInflater.inflate(R.layout.goods_adapter_banner_item, mBinding.flow, false);
                ImageView imgIcon = layout.findViewById(R.id.img_icon);
                Glide.with(getActivity())
                        .load(menuEntity.getAppIcon())
                        .apply(new RequestOptions()
                                .error(R.drawable.user_center_def_img)
                                .placeholder(R.drawable.user_center_def_img)
                                .fallback(R.drawable.user_center_def_img))
                        .into(imgIcon);
                return layout;
            }
        };
        mBinding.flow.setAdapter(searchAdapter);
        mBinding.flow.setOnTagClickListener((view, position, parent) -> {
            if ("2".equals(menuDataList.get(position).getId())) {
                homeFragment3.goLogin(getActivity());
            } else if ("26".equals(menuDataList.get(position).getId())) {
                SupplierActivity4.start(getActivity(), true, bundleData);
            } else if ("23".equals(menuDataList.get(position).getId())) {
                NewDemandHallActivity.start(getActivity());
            } else if ("35".equals(menuDataList.get(position).getId()) && !UserOperating.getInstance().isLogged()) {
                jumpLogin();
            } else if ("36".equals(menuDataList.get(position).getId())) {
                AuctionHallActivity.start(getActivity(), "2");
            } else {
                List<MenuEntity> menuEntities = getMenuEntities(goodsNavigationAdapter.getDatas());
                boolean isNeed = false;
                for (MenuEntity menuEntity1 : menuEntities) {
                    if ("36".equals(menuEntity1.getId())) {
                        isNeed = true;
                        break;
                    }
                }
                if (isNeed) {
                    menuEntities.remove(5); //拍卖大厅
                }
                menuEntities.remove(5); //需求大厅
                menuEntities.remove(5); //查找地图
                if (position >= 7) {
                    if (isNeed) {
                        position = position - 3;
                    } else {
                        position = position - 2;
                    }
                }
                DatalUtils.getInstance().putData(MkvUtils.CacheModular, CacheMarker.CacheGoodsCategoryModel, menuEntityList1);
                GoodsAggregateActivity.start(getActivity(), menuEntities, position, "", null, null, false);
            }
            return true;
        });
    }

    public void showIndustry(List<MenuEntity> datas) {
        this.industryList = datas;
        MenuEntity all = new MenuEntity("", "全部");
        industryList.add(0, all);
        materiaIndustryAdapter.setDefItem(0);
        materiaIndustryAdapter.setDatas(industryList);
        expend();
    }

    public List<MenuEntity> getAllData() {
        return data;
    }

    /***
     * 展示三级筛选数据
     * @param data 源数据
     */
    public void showCategoryView(List<MenuEntity<MenuEntity<MenuEntity>>> data) {
        this.menuEntityList.clear();
        this.bundleData.clear();
        this.dataList.clear();
        this.mMaterialData = data;
        List<MenuEntity> menuEntityList = getFilteredMenuEntityList(data, false);
        mBinding.swipeRefresh.setRefreshing(false);
        bundleData.addAll(menuEntityList);
        this.menuEntityList = menuEntityList;
        this.data = menuEntityList;
        List<MenuEntity<MenuEntity<MenuEntity>>> reBuildMenuEntity = reBuildMenuEntity(data);
        this.menuEntityList1 = reBuildMenuEntity;
        dataList.addAll(menuEntityList);
        MenuEntity menuEntity = new MenuEntity();
        menuEntity.setName("全部");
        menuEntity.setId("");
        dataList.add(0, menuEntity);
        if (!isLoad) {
            GoodsMainGoodsListFragment3 mGoods = GoodsMainGoodsListFragment3.newInstance(0, menuEntityList1, "", null, null, false, false, false, "");
            mGoods.setParentFragment(this);
            fragmentList.add(mGoods);

            GoodsMainGoodsListFragment3 selfEmployedGoods = GoodsMainGoodsListFragment3.newInstance(0, menuEntityList1, "", null, null, true, false, false, "");
            selfEmployedGoods.setParentFragment(this);

            fragmentList.add(selfEmployedGoods);
            fragmentList.add(FactoryCentralizedFragment.newInstance(0, "0"));

            GoodsMainGoodsListFragment3 promotionGoodsFragment = GoodsMainGoodsListFragment3.newInstance(0, menuEntityList1, "", null, null, false, true, false, "");
            promotionGoodsFragment.setParentFragment(this);
            fragmentList.add(promotionGoodsFragment);

            fragmentList.add(NewDemandHallFragment.newInstance("", ""));
            fragmentList.add(MerchantRecommendationFragment.newInstance());

            if (mTabFragmentStateAdapter == null) {
                mTabFragmentStateAdapter = new TabFragmentStateAdapter(requireActivity(), fragmentList);
            }
            mBinding.viewPager.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
            mBinding.viewPager.setAdapter(mTabFragmentStateAdapter);
            new TabLayoutMediator(mBinding.tabLayout, mBinding.viewPager, (tab, position) -> tab.setText(tagName[position])).attach();
            mBinding.viewPager.setOffscreenPageLimit(fragmentList.size());
            isLoad = true;
        }

    }

    /***
     * 获取第一级商品类别的数据
     * @param menuEntityList
     * @param isNeedFilter
     * @return
     */
    private List<MenuEntity> getFilteredMenuEntityList(List<MenuEntity<MenuEntity<MenuEntity>>> menuEntityList, boolean isNeedFilter) {
        List<MenuEntity> entityList = new ArrayList<>();
        for (int i = 0; i < menuEntityList.size(); i++) {
            MenuEntity entity = new MenuEntity();
            entity.setAppIcon(menuEntityList.get(i).getAppIcon());
            entity.setAppIconUrl(menuEntityList.get(i).getAppIconUrl());
            entity.setId(menuEntityList.get(i).getId());
            entity.setSelected(menuEntityList.get(i).isSelected());
            entity.setUrl(menuEntityList.get(i).getUrl());
            if (isNeedFilter) {
                if (menuEntityList.get(i).getName().length() > 6) {
                    String name = menuEntityList.get(i).getName().substring(0, 5) + "...";
                    entity.setName(name);
                } else {
                    entity.setName(menuEntityList.get(i).getName());
                }
            } else {
                entity.setName(menuEntityList.get(i).getName());
            }
            entityList.add(entity);
        }
        return entityList;
    }

    /***
     *修改原数据,每级分类集合数据第一条数据新增“全部”选项
     */
    private List<MenuEntity<MenuEntity<MenuEntity>>> reBuildMenuEntity(List<MenuEntity<MenuEntity<MenuEntity>>> menuEntityList) {

        MenuEntity<MenuEntity<MenuEntity>> children = new MenuEntity<>();
        children.setName("全部");
        children.setId("");
        menuEntityList.add(0, children);

        for (int index0 = 0; index0 < menuEntityList.size(); index0++) {
            List<MenuEntity<MenuEntity>> menuEntityList1 = menuEntityList.get(index0).getDatas();
            if (menuEntityList1 == null) {
                menuEntityList1 = new ArrayList<>();
            }
            MenuEntity<MenuEntity> menuEntity1 = new MenuEntity<>();
            menuEntity1.setName("全部");
            menuEntity1.setId("");
            menuEntityList1.add(0, menuEntity1);
        }

        for (int index0 = 0; index0 < menuEntityList.size(); index0++) {
            List<MenuEntity<MenuEntity>> menuEntityList1 = menuEntityList.get(index0).getDatas();
            if (menuEntityList1 == null) {
                menuEntityList1 = new ArrayList<>();
            }
            for (MenuEntity<MenuEntity> menuEntity : menuEntityList1) {
                List<MenuEntity> menuEntityList2 = menuEntity.getDatas();
                if (menuEntityList2 == null) {
                    menuEntityList2 = new ArrayList<>();
                }
                MenuEntity menuEntity2 = new MenuEntity<>();
                menuEntity2.setName("全部");
                menuEntity2.setId("");
                menuEntityList2.add(0, menuEntity2);
            }
        }
        return menuEntityList;
    }

    public void showMenuView(List<MenuEntity> data) {
        if (data == null || data.size() == 0) {
            return;
        }
        data.remove(0);
        List<MenuEntity> entityList = getReBuildMenuEntityList(data);
        mBinding.calendarMenuView.ROW_COUNT = 2;
        mBinding.calendarMenuView.initData(getChildFragmentManager(), entityList, new CountMenuView.OnItemClick() {
            @Override
            public void onItemClick(MenuEntity entity, int position, int num) {
                List<MenuEntity> menuEntities = getMenuEntities(goodsNavigationAdapter.getDatas());
                menuEntities.remove(5); //需求大厅
                menuEntities.remove(5); //查找地图
                if (position >= 7) {
                    position = position - 2;
                }

                DatalUtils.getInstance().putData(MkvUtils.CacheModular, CacheMarker.CacheGoodsCategoryModel, menuEntityList1);
                if (!"".equals(entity.getId())) {
                    GoodsAggregateActivity.start(getActivity(), menuEntities, 0, entity.getId(), "", null, false);
                } else {
                    GoodsAggregateActivity.start(getActivity(), menuEntities, 0, entity.getId(), null, null, false);
                }
            }
        }, true);

        MenuAdapter menuAdapter = new MenuAdapter(getActivity(), data);
        menuAdapter.onlyImage(true);
        mBinding.rvAllMenu.setLayoutManager(new GridLayoutManager(getActivity(), 5));
        mBinding.rvAllMenu.setAdapter(menuAdapter);
        menuAdapter.setOnItemClick(new PageRecycleAdapter.OnItemClick<MenuEntity>() {
            @Override
            public void onClick(MenuEntity entity, int position) {
                List<MenuEntity> menuEntities = getMenuEntities(goodsNavigationAdapter.getDatas());
                menuEntities.remove(5); //需求大厅
                menuEntities.remove(5); //查找地图
                if (position >= 7) {
                    position = position - 2;
                }

                DatalUtils.getInstance().putData(MkvUtils.CacheModular, CacheMarker.CacheGoodsCategoryModel, menuEntityList1);
                if (!"".equals(entity.getId())) {
                    GoodsAggregateActivity.start(getActivity(), menuEntities, 0, entity.getId(), "", null, false);
                } else {
                    GoodsAggregateActivity.start(getActivity(), menuEntities, 0, entity.getId(), null, null, false);
                }
            }
        });

        mBinding.containerMenuUp.setOnClickListener(view -> {
            mBinding.rlShowAllMenu.setVisibility(View.GONE);
            mBinding.rlShowPageMenu.setVisibility(View.VISIBLE);
        });
        mBinding.containerMenuDown.setOnClickListener(view -> {
            mBinding.rlShowAllMenu.setVisibility(View.VISIBLE);
            mBinding.rlShowPageMenu.setVisibility(View.GONE);
        });

    }

    public static List<IndustryHomeListEntity.IndustryItem> IndustryItemlist = new ArrayList<>();

    public void ShowMenuViewTabIndustry(List<IndustryHomeListEntity.IndustryItem> data) {
        if (data == null || data.size() == 0 || IndustryItemlist.size() > 0) {
            return;
        }
        IndustryItemlist.clear();
        IndustryItemlist.addAll(data);
        data.remove(0);
        List<MenuEntity> entityList = getReBuildMenuEntityListForIndustry(data);
        mBinding.calendarMenuView.ROW_COUNT = 2;
        mBinding.calendarMenuView.initData(getChildFragmentManager(), entityList, new CountMenuView.OnItemClick() {
            @Override
            public void onItemClick(MenuEntity entity, int position, int num) {
                List<MenuEntity> menuEntities = getMenuEntities(goodsNavigationAdapter.getDatas());
                menuEntities.remove(5); //需求大厅
                menuEntities.remove(5); //查找地图
                if (position >= 7) {
                    position = position - 2;
                }
                DatalUtils.getInstance().putData(MkvUtils.CacheModular, CacheMarker.CacheGoodsCategoryModel, menuEntityList1);
                if (!"".equals(entity.getId())) {
                    GoodsAggregateActivity.start(getActivity(), menuEntities, 0, null, null, null, false, entity.getId());
                } else {
                    GoodsAggregateActivity.start(getActivity(), menuEntities, 0, null, null, null, false, "");
                }
            }
        }, true);


        MenuAdapter menuAdapter = new MenuAdapter(getActivity(), getReBuildMenuEntityListForIndustry(data));
        menuAdapter.onlyImage(true);
        mBinding.rvAllMenu.setLayoutManager(new GridLayoutManager(getActivity(), 5));
        mBinding.rvAllMenu.setAdapter(menuAdapter);
        menuAdapter.setOnItemClick(new PageRecycleAdapter.OnItemClick<MenuEntity>() {
            @Override
            public void onClick(MenuEntity entity, int position) {
                List<MenuEntity> menuEntities = getMenuEntities(goodsNavigationAdapter.getDatas());
                menuEntities.remove(5); //需求大厅
                menuEntities.remove(5); //查找地图
                if (position >= 7) {
                    position = position - 2;
                }
                DatalUtils.getInstance().putData(MkvUtils.CacheModular, CacheMarker.CacheGoodsCategoryModel, menuEntityList1);
                if (!"".equals(entity.getId())) {
                    GoodsAggregateActivity.start(getActivity(), menuEntities, 0, null, null, null, false, entity.getId());
                } else {
                    GoodsAggregateActivity.start(getActivity(), menuEntities, 0, null, null, null, false, "");
                }
            }
        });

        mBinding.containerMenuUp.setOnClickListener(view -> {
            mBinding.rlShowAllMenu.setVisibility(View.GONE);
            mBinding.rlShowPageMenu.setVisibility(View.VISIBLE);
        });
        mBinding.containerMenuDown.setOnClickListener(view -> {
            mBinding.rlShowAllMenu.setVisibility(View.VISIBLE);
            mBinding.rlShowPageMenu.setVisibility(View.GONE);
        });
    }

    /**
     * 获取第一级商品类别
     *
     * @param menuEntityList
     * @return
     */
    private List<MenuEntity> getReBuildMenuEntityList(List<MenuEntity> menuEntityList) {
        List<MenuEntity> entityList = new ArrayList<>();
        for (int i = 0; i < menuEntityList.size(); i++) {
            MenuEntity entity = new MenuEntity();
            entity.setAppIcon(menuEntityList.get(i).getAppIcon());
            entity.setAppIconUrl(menuEntityList.get(i).getAppIconUrl());
            entity.setId(menuEntityList.get(i).getId());
            entity.setSelected(menuEntityList.get(i).isSelected());
            entity.setUrl(menuEntityList.get(i).getUrl());
            if (menuEntityList.get(i).getName().length() > 6) {
                String name = menuEntityList.get(i).getName().substring(0, 5) + "...";
                entity.setName(name);
            } else {
                entity.setName(menuEntityList.get(i).getName());
            }
            entityList.add(entity);
        }
        return entityList;
    }

    /**
     * 获取行业展示推荐
     */
    private List<MenuEntity> getReBuildMenuEntityListForIndustry(List<IndustryHomeListEntity.IndustryItem> data) {
        List<MenuEntity> entityList = new ArrayList<>();
        for (int i = 0; i < data.size(); i++) {
            MenuEntity entity = new MenuEntity();
            entity.setAppIcon(data.get(i).getIcon());
            entity.setAppIconUrl(data.get(i).getIcon());
            entity.setId(data.get(i).getId() + "");
            entity.setSelected(data.get(i).isSelected());
            entity.setUrl(data.get(i).getIcon());
            if (data.get(i).getName().length() > 6) {
                String name = data.get(i).getName().substring(0, 5) + "...";
                entity.setName(name);
            } else {
                entity.setName(data.get(i).getName());
            }
            entityList.add(entity);
        }

        return entityList;
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(MenuEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_MENU_POWER) {
            MLog.d("api", event.getNo());
            PowerListActivity.start(getActivity(), event.getNo(), event.getChildNo());
        } else if (event.getMessageTag() == EVENT_GOODS_HOME_JUMP) {
        } else if (event.getMessageTag() == EVENT_MAP_HOME_JUMP) {
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(MaterialEvent event) {

        if (event.getMessageTag() == EventConstant.EVENT_LOGISTICS_WINDOW_TOP) {

            mBinding.appBarLayout.setExpanded(false);
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(ChooseAreaEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_CHOOSE_AERA) {
            if (mBinding == null || model == null) {
                return;
            }
            mBinding.swipeRefresh.setRefreshing(false);
            textView.setText("正在刷新");
            model.getIndustryListdata("", mIndustryId);
            model.recommendMenu();
            bigHomeCompary.unInit();
            //获取首页企业推荐
            model.getCompanyTitleList("EventConstant.EVENT_NOTICE_REFRESH_HOME");
        }
    }


    @Override
    public void onResume() {
        super.onResume();
        if (!UserOperating.getInstance().isLogged()) {
            if (indexClickPosition == 0 || indexClickPosition == 1 || indexClickPosition == 2) {
                mBinding.noLogin.setVisibility(View.VISIBLE);
                mBinding.loginNoData.setVisibility(View.GONE);
                mBinding.recyclerIndexData.setVisibility(View.GONE);
            }
        }

        if (bigHomeCompary != null) {
            bigHomeCompary.startTimer();
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        if (bigHomeCompary != null)
            bigHomeCompary.stopTimer();
    }

    //登录接收
    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(LoginEvent event) {
        if (event.getMessageTag() == EventConstant.EVENT_SHOPPING_LOGIN) {
            SharedPreferenceUtil.getInstance().saveString("EVENT_SHOPPING_TYPE", "");
        }
        if (event.getMessageTag() == EventConstant.EVENT_LOGIN) {
            setCompanyData();
        }

        if (bigHomeCompary != null) {
            bigHomeCompary.unInit();
            //获取首页企业推荐
            model.getCompanyTitleList("EventConstant.EVENT_NOTICE_REFRESH_HOME");
        }
    }

    private void setCompanyData() {
        if (indexClickPosition == 0) {
            initMember();
        } else if (indexClickPosition == 1) {
            initLeague();
        } else if (indexClickPosition == 2) {
            initCompanyFocus();
        }
    }


    //切换身份
    @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
    public void onEvent(String event) {
        if (event.equals(EventConstant.EVENT_REFRESH_MAIN_GOODS)) {
            for (int i = 0; i < listGoodsInfo.size(); i++) {
                listGoodsInfo.get(i).setSelect(false);
            }
            listGoodsInfo.get(0).setSelect(true);
            indexClickPosition = 0;
            TabLayout.Tab tab = mBinding.tlCompanyTitle.getTabAt(indexClickPosition);
            if (tab != null) {
                tab.select();
            }
            if (bigHomeCompary != null) {
                bigHomeCompary.unInit();
            }
            //获取首页企业推荐
            model.getCompanyTitleList("EventConstant.EVENT_NOTICE_REFRESH_HOME");
            initMember();
        }
    }

    @Override
    public void onDestroy() {
        EventBus.getDefault().unregister(this);
        super.onDestroy();
    }

    public void jumpLogin() {
        VerificationCodeLoginActivity.start(getActivity());
    }

    /**
     * ginPage()
     * <p>
     * /**
     * 一键登录成功
     *
     * @param loginEntity
     * @param phoneNumber
     */
    public void loginSucceed(LoginEntity loginEntity, String phoneNumber) {
        LoginEvent loginEvent = new LoginEvent();
        loginEvent.setMessageData(phoneNumber);
        loginEvent.setMessageTag(EventConstant.EVENT_LOGIN);
        loginEvent.setObject(loginEntity);
        EventBus.getDefault().postSticky(loginEvent);
    }

    public void getUserMsgSucceed(UserMsgEntity userMsgEntity) {
        LoginEvent loginEvent = new LoginEvent();
        loginEvent.setMessageTag(EventConstant.EVENT_USER_MSG);
        loginEvent.setMessageData(userMsgEntity);
        EventBus.getDefault().postSticky(loginEvent);
    }


    public void startForResemble(String firstCategoryId, String secondCategoryId, String thirdCategoryId, int position) {
        if (firstCategoryId == null) {
            firstCategoryId = ""; //如果第一级分类没有数据，重置默认全部
        } else {
            if (secondCategoryId != null && !"".equals(secondCategoryId) && thirdCategoryId == null) {
                thirdCategoryId = "";//如果第二级有数据并且默认不为全部，同时第三级分类没有数据，那么第三级分类重置为默认
            }
        }
        DatalUtils.getInstance().putData(MkvUtils.CacheModular, CacheMarker.CacheGoodsCategoryModel, menuEntityList1);
        if (IndustryItemlist.size() > 0) {
            model.getIndustryId(firstCategoryId, secondCategoryId, thirdCategoryId, position);
        } else {
            GoodsAggregateActivity.start(getActivity(), goodsNavigationAdapter.getDatas(), position, firstCategoryId, secondCategoryId, thirdCategoryId, false);
        }
    }

    public void startForResemble(String firstCategoryId, String secondCategoryId, String thirdCategoryId, int position, String hyid) {
        GoodsAggregateActivity.start(getActivity(), goodsNavigationAdapter.getDatas(), position, firstCategoryId, secondCategoryId, thirdCategoryId, false, hyid);
    }

    private void initMember() {
        if (UserOperating.getInstance().isLogged()) {
            model.getMember();
        } else {
            mBinding.noLogin.setVisibility(View.VISIBLE);
            mBinding.loginNoData.setVisibility(View.GONE);
            mBinding.recyclerIndexData.setVisibility(View.GONE);
        }
    }

    public void requestMemberResult(GoodsIndexMemberEntity list) {
        if (list != null && list.getMember() != null && list.getMember().size() > 0) {
            mBinding.noLogin.setVisibility(View.GONE);
            mBinding.loginNoData.setVisibility(View.GONE);
            mBinding.recyclerIndexData.setVisibility(View.VISIBLE);
            List<GoodsIndexMemberEntity> listData = list.getMember();
            if (listData.size() > 6) {
                listData = listData.subList(0, 6);
            }
            for (int i = 0; i < listData.size(); i++) {
                listData.get(i).setType("0");
            }
            goodsCompanyAdapter.setNewData(listData);
        } else {
            mBinding.noLogin.setVisibility(View.GONE);
            mBinding.loginNoData.setVisibility(View.VISIBLE);
            mBinding.noDataInfo.setText("您还没有成员企业，快去邀请吧！");
            mBinding.noDataBtn.setText("邀请成员");
            mBinding.noDataBtn.setVisibility(View.VISIBLE);
            mBinding.recyclerIndexData.setVisibility(View.GONE);
        }
    }


    private void initLeague() {
        if (UserOperating.getInstance().isLogged()) {
            model.getLeague();
        } else {
            mBinding.noLogin.setVisibility(View.VISIBLE);
            mBinding.loginNoData.setVisibility(View.GONE);
            mBinding.recyclerIndexData.setVisibility(View.GONE);
        }
    }


    public void requestLeagueResult(GoodsIndexMemberEntity list) {
        if (list != null && list.getLeague() != null && list.getLeague().size() > 0) {
            mBinding.noLogin.setVisibility(View.GONE);
            mBinding.loginNoData.setVisibility(View.GONE);
            mBinding.recyclerIndexData.setVisibility(View.VISIBLE);
            List<GoodsIndexMemberEntity> listData = list.getLeague();
            if (listData.size() > 6) {
                listData = listData.subList(0, 6);
            }
            for (int i = 0; i < listData.size(); i++) {
                listData.get(i).setType("1");
            }
            goodsCompanyAdapter.setNewData(listData);
        } else {
            mBinding.noLogin.setVisibility(View.GONE);
            mBinding.loginNoData.setVisibility(View.VISIBLE);
            mBinding.noDataInfo.setText("您还没有会员企业，快去邀请吧！");
            mBinding.noDataBtn.setText("邀请会员");
            mBinding.noDataBtn.setVisibility(View.VISIBLE);
            mBinding.recyclerIndexData.setVisibility(View.GONE);
        }
    }


    private void initCompanyFocus() {
        if (UserOperating.getInstance().isLogged()) {
            model.getCompanyFocus();
        } else {
            mBinding.noLogin.setVisibility(View.VISIBLE);
            mBinding.loginNoData.setVisibility(View.GONE);
            mBinding.recyclerIndexData.setVisibility(View.GONE);
        }
    }

    public void requestCompanyFocus(List<GoodsIndexMemberEntity> list) {
        if (list != null && list.size() > 0) {
            mBinding.noLogin.setVisibility(View.GONE);
            mBinding.loginNoData.setVisibility(View.GONE);
            mBinding.recyclerIndexData.setVisibility(View.VISIBLE);
            for (int i = 0; i < list.size(); i++) {
                list.get(i).setType("2");
            }
            goodsCompanyAdapter.setNewData(list);
        } else {
            mBinding.noLogin.setVisibility(View.GONE);
            mBinding.loginNoData.setVisibility(View.VISIBLE);
            mBinding.noDataInfo.setText("您还没有关注其他企业，快去看看吧！");
            mBinding.noDataBtn.setText("企业大全");
            mBinding.noDataBtn.setVisibility(View.VISIBLE);
            mBinding.recyclerIndexData.setVisibility(View.GONE);
        }
    }

    private void initSupplier() {
        model.getSupplierListModel();
    }


    public void requestSupplierResult(List<GoodsIndexMemberEntity> list) {
        if (list != null && list.size() > 0) {
            mBinding.noLogin.setVisibility(View.GONE);
            mBinding.loginNoData.setVisibility(View.GONE);
            mBinding.recyclerIndexData.setVisibility(View.VISIBLE);
            for (int i = 0; i < list.size(); i++) {
                list.get(i).setType("3");
            }
            goodsCompanyAdapter.setNewData(list);
        } else {
            mBinding.noLogin.setVisibility(View.GONE);
            mBinding.loginNoData.setVisibility(View.VISIBLE);
            mBinding.noDataInfo.setText("暂无推荐企业");
            mBinding.noDataBtn.setText("");
            mBinding.noDataBtn.setVisibility(View.GONE);
            mBinding.recyclerIndexData.setVisibility(View.GONE);
        }

    }

    /**
     * 成员权限判断，进行切换企业
     */
    private boolean MemberApplyJoin() {
        //0--个人 1--企业 2--团队 3--组织
        int type = UserOperating.getInstance().getUserIdentity();
        if (type == 1) {
            return true;
        } else {
            new RoundDialog.Builder(getActivity())
                    .title("您没有权限")
                    .content("请将身份切换到企业或者加入已认证企业后再试")
                    .confirm("切换身份")
                    .cancel("知道了")
                    .singleBtn(false)
                    .contentGravity(Gravity.CENTER)
                    .cancelable(false)
                    .confirmCallback(v -> {
                        ((MainActivity) getActivity()).displayFrg(3);
                        ((MainActivity) getActivity()).showTabView(3);
                    })
                    .show();
            return false;
        }
    }

    /**
     * 会员权限判断，进行切换企业
     */
    private boolean LeageApplyJoin() {
        //0--个人 1--企业 2--团队 3--组织
        int type = UserOperating.getInstance().getUserIdentity();
        if (type == 1) {
            return true;
        } else if (type == 0) {
            if (!SharedPreferenceUtil.getInstance().getSaveBooleanData(SharedPreferenceUtil.PERSON_AUTH, false)) {
                //已实名需要加入企业
                new ThreeButtonDialog.Builder(getActivity())
                        .title("温馨提示")
                        .content("您没有权限，请先认证为实名用户/企业用户后再试！")
                        .confirmCallback(v -> {
                            //实名认证
                            AuthActivity3.start(getActivity());
                        }).joinCallback(v -> {
                    //去加入企业
                    JoinCompanyActivity.start(getActivity());
                }).cancel("知道了").show();
                return false;
            } else {
                return true;
            }
        } else {
            new RoundDialog.Builder(getActivity())
                    .title("您没有权限")
                    .content("请将身份切换到企业或者加入已认证企业后再试")
                    .confirm("切换身份")
                    .cancel("知道了")
                    .singleBtn(false)
                    .contentGravity(Gravity.CENTER)
                    .cancelable(false)
                    .confirmCallback(v -> {
                        ((MainActivity) getActivity()).displayFrg(3);
                        ((MainActivity) getActivity()).showTabView(3);
                    })
                    .show();
            return false;
        }
    }


    /**
     * 初始化首页企业推荐界面
     */
    public void initCompanyTitle(List<EnterpriseEditEntity> data) {
        if (mBinding == null) return;
        vsCompany = mBinding.vsCompany.getViewStub();
        if (vsCompany != null)
            vsCompany.inflate();
        if (vsCompany != null) {
            inflatedCompany = mBinding.getRoot().findViewById(R.id.inflatedCompany);
            bigHomeCompary = new BigHomeComparyWidget(this, inflatedCompany);
        }
        if (bigHomeCompary != null) {
            bigHomeCompary.unInit();
        }
        if (data == null || data.size() == 0) return;
        bigHomeCompary.initData(data);
        boolean isType = MkvUtils.get().getBoolean(MkvUtils.CommomData, CacheMarker.DisplaySettingsType, true);
        boolean isQY = MkvUtils.get().getBoolean(MkvUtils.CommomData, CacheMarker.DisplaySettingsQY, true);
        bigHomeCompary.setIsAotu(isType, isQY);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void updateIndex(UpdateIndexEvent event) {
        if (event != null) {
            QuickEntryEntity quickEntryEntity = new QuickEntryEntity();
            switch (event.getIndexposition()) {
                case 0:
                    quickEntryEntity.setId("1-1");
                    break;
                case 1:
                    quickEntryEntity.setId("1-2");
                    break;
                case 2:
                    quickEntryEntity.setId("1-3");
                    break;
                case 3:
                    quickEntryEntity.setId("1-4");
                    break;
                case 5:
                    quickEntryEntity.setId("1-5");
                    break;
            }
            this.onItemClick(quickEntryEntity);
        }
    }

    @Override
    public void onItemClick(QuickEntryEntity entity) {
        changeTabFragmentEvent(entity.getId());
        switch (entity.getId()) {
            case "0": //首页/网站推荐
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 21));
                break;
            case "1": //商品/销售
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 1));
                break;
            case "1-1": //全部商品
                if (titleData == null) {
                    model.recommendMenu(0, false);
                } else {
                    showImageButtonData(titleData, 0, false);
                }
                break;
            case "1-2": //自营商品
                if (titleData == null) {
                    model.recommendMenu(1, false);
                } else {
                    showImageButtonData(titleData, 1, false);
                }
                break;
            case "1-3": //集采商品
                if (titleData == null) {
                    model.recommendMenu(2, false);
                } else {
                    showImageButtonData(titleData, 2, false);
                }
                break;
            case "1-4": //促销商品
                if (titleData == null) {
                    model.recommendMenu(3, false);
                } else {
                    showImageButtonData(titleData, 3, false);
                }
                break;
            case "1-5": //供应商
                if (titleData == null) {
                    model.recommendMenu(5, false);
                } else {
                    showImageButtonData(titleData, 5, false);
                }
                break;
            case "2": //招标竞价
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 2));
                break;
            case "2-1": //招标大厅
                PickListActivity.start(getActivity(), "1", 0);
                break;
            case "2-2": //招标公告
                PickListActivity.start(getActivity(), "2", 0);
                break;
            case "2-3": //直接竞价
                PickBiddingListActivity.start(getActivity());
                break;
            case "2-4": //需求预告
                DemandForecastActivity.start(getActivity());
                break;
            case "2-5": //招标预告
                PickNoticeActivity.start(getActivity());
                break;
            case "2-6": //中标公告
                PickWinningNoticeActivity.start(getActivity());
                break;
            case "3": //集采团购
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 3));
                break;
            case "3-1": //集采大厅
                JiCaiDaTingActivity.start(getActivity());
                break;
            case "3-2": //需方发起
                XuFangFaQiActivity.start(getActivity(), "1");
                break;
            case "3-3": //供方发起
                FactoryCentralizedActivity.start(getActivity());
                break;
            case "3-4": //企业专项
                XuFangFaQiActivity.start(getActivity(), "2");
                break;
            case "3-5": //我的加盟
                if (!TextUtils.isEmpty(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                    MyCenterMyJoinActivity.start(getActivity());
                } else {
                    VerificationCodeLoginActivity.start(getActivity());
                }
                break;
            case "3-6": //我的报价
                if (!TextUtils.isEmpty(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                    JcMyPriceActivity.start(getActivity());
                } else {
                    VerificationCodeLoginActivity.start(getActivity());
                }
                break;
            case "4": //租赁转让
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 4));
                break;
            case "4-1": //出租大厅
                LeaseHallActivity2.start(getActivity());
                break;
            case "4-2": //需求大厅
                LeaseHallActivity2.start(getActivity(), 1, 0);
                break;
            case "5": //工队工人
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 5));
                break;
            case "5-1": //临时用工
                //临时用工-工队首页点击用工需求
                //"用工需求","工人大厅","工队大厅","工种报价","工程分包","工程公司","人气工队"
                com.swgk.core.common.utils.ActivityJump.startActivity(PathTeam.PackersTabActivity, Pair.create("type", 0));
                break;
            case "5-2": //找工人
                //找工人-工队首页点击个人大厅
                com.swgk.core.common.utils.ActivityJump.startActivity(PathTeam.PackersTabActivity, Pair.create("type", 1));
                break;
            case "5-3": //施工队
                //施工队，班组工队，劳务公司-工队首页点击工队大厅 {"施工队", "班组工队", "劳务公司", "记工记账"};
                com.swgk.core.common.utils.ActivityJump.startActivity(PathTeam.PackersTabActivity, Pair.create("type", 2));
                break;
            case "5-4": //班组工队
                com.swgk.core.common.utils.ActivityJump.startActivity(PathTeam.PackersTabActivity,
                        Pair.create("type", 2), Pair.create("childPosition", 1));
                break;
            case "5-5": //工程公司
                //"用工需求","工人大厅","工队大厅","工种报价","工程分包","工程公司","人气工队"
                com.swgk.core.common.utils.ActivityJump.startActivity(PathTeam.PackersTabActivity,
                        Pair.create("type", 5));
                break;
            case "5-6": //劳务公司 -工队首页点击工队大厅
                com.swgk.core.common.utils.ActivityJump.startActivity(PathTeam.PackersTabActivity,
                        Pair.create("type", 2), Pair.create("childPosition", 2));
                break;
            case "5-7": //工种报价
                //"用工需求","工人大厅","工队大厅","工种报价","工程分包","工程公司","人气工队"
                com.swgk.core.common.utils.ActivityJump.startActivity(PathTeam.PackersTabActivity, Pair.create("type", 3));
                break;
            case "6": //物流货运
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 6));
                break;
            case "6-1": //货运大厅
                GoodsCarsActivity.start(getActivity(), 0, false);
                break;
            case "6-2": //货车大厅
                GoodsCarsActivity.start(getActivity(), 1, true);
                break;
            case "6-3": //竞价货运
                BiddingTransportHallActivity.start(getContext());
                break;
            case "6-4": //竞价承运
                DriverLookForGoodsActivity.start(getContext());
                break;
            case "7": //企业服务
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 22));
                break;
            case "7-1": //服务大厅
                ProfessionalQuoteActivity.start(getActivity());
                break;
            case "7-2": //需求大厅
                NeedActivity.start(getActivity());
                break;
            case "7-3": //知产交易
                ActivityJump.jumpToActivity(getActivity(), MakeOverActivity.class);
                break;
            case "7-4": //专业团队
                ActivityJump.jumpToActivity(getActivity(), ProfessionalTeamChangeActivity.class);
                break;
            case "8": //会员经营
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 24));
                break;
            case "8-1": //会员管理
                if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                    VerificationCodeLoginActivity.start(getActivity());
                } else {
                    MemberManageActivity.start(getActivity());
                }
                break;
            case "8-2": //邀请会员
                if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                    VerificationCodeLoginActivity.start(getActivity());
                } else {
                    MemberInviteOrApplyActivity.startInviteOrApply(getActivity(), 0);
                }
                break;
            case "8-3": //申请加盟
                if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                    VerificationCodeLoginActivity.start(getActivity());
                } else {
                    MemberInviteOrApplyActivity.startInviteOrApply(getActivity(), 1);
                }
                break;
            case "8-4": //会员审核
                if ("".equals(SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LOGIN_TOKEN, ""))) {
                    VerificationCodeLoginActivity.start(getActivity());
                } else {
                    MemberAuditActivity.start(getActivity());
                }
                break;
            case "9": //企业经营
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 23));
                break;
            case "9-1": //经营大厅
                String longitude = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LONGITUDE_ID, "");
                String latitude = SharedPreferenceUtil.getInstance().getSaveStringData(SharedPreferenceUtil.LATITUDE_ID, "");
                ActivityJump.jumpToActivity(getActivity(), ManageActivity.class, Pair.create("latitude", latitude), Pair.create("longitude", longitude));
                break;
            case "9-2": //专项资质
                SpecialQualificationActivity.startAction(getActivity());
                break;
            case "9-3": //知识产权
                IPActivity.startAction(getActivity());
                break;
            case "9-4": //专项资产
                EpAssestActivity.start(getActivity());
                break;
            case "9-5": //荣誉荣耀
                TradeHonorActivity.start(getActivity());
                break;
            case "9-6": //经营动态
                ActivityJump.jumpToActivity(getActivity(), CompanyTradesActivity.class);
                break;
            case "10": //招商引资
                EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 27));
                break;
            case "10-1": //投资项目
                ARouter.getInstance().build(PathMerchant.InvestmentProjectActivity).navigation();
                break;
            case "10-2": //投资需求
                ARouter.getInstance().build(PathMerchant.DemandListActivity).navigation();
                break;
        }
        //关闭弹框
        if (quickEntryPopWindow != null) {
            quickEntryPopWindow.dismiss();
        }
    }

    //首次预请求商品所需数据
    public void setRecommendMenuData(List<MenuEntity> datas) {
        this.titleData = datas;
    }

    private List<MenuEntity<MenuEntity<MenuEntity>>> mMaterialData = new ArrayList<>();

    public void showImageButtonData(List<MenuEntity> datas, int position, boolean isMap) {
        this.titleData = datas;
        if (mMaterialData == null) {
            model.recomandCate(true);
            return;
        }
        DatalUtils.getInstance().putData(MkvUtils.CacheModular, CacheMarker.CacheGoodsCategoryModel, mMaterialData);
        GoodsAggregateActivity.start(getActivity(), null, position, "", null, null, isMap);
    }

    private void changeTabFragmentEvent(String id) {
        if (!TextUtils.isEmpty(id) && id.contains("-")) {
            int newId = Integer.parseInt(id.substring(0, id.indexOf("-")));
            switch (newId) {
                case 1:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 1));
                    break;
                case 2:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 2));
                    break;
                case 3:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 3));
                    break;
                case 4:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 4));
                    break;
                case 5:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 5));
                    break;
                case 6:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 6));
                    break;
                case 7:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 22));
                    break;
                case 8:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 24));
                    break;
                case 9:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 23));
                    break;
                case 10:
                    EventBus.getDefault().postSticky(CategoryEvent2.make(EventConstant.EVENT_CATEGORY_CHOOSE2, 27));
                    break;
            }
        }
    }

    @SuppressLint({"AutoDispose", "CheckResult"})
    public void showRecommendCate(List<HomeMenuEntity> data, boolean isRefresh) {
    }


}